package com.ymatou.iapi.wxtoken.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.wxtoken.service.GetTicketCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.database.sqlwapper.WXToken2Wapper;
/**
*获取微信Ticket
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_GetTicket{
	private static GetTicketCall getticketCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取微信Ticket");
	}

	@Before
	public void caseUp() {
		getticketCall=new GetTicketCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getticketCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetTicket_001() {
		Logger.start(true,"获取微信Ticket,成功");
		try {
			String tk = new WXToken2Wapper().selectWxtokenByType(1).get(0).get("Token").toString();
			getticketCall.callService();			
			Logger.verifyEquals(tk, getticketCall.getReturnData(), "验证Ticket");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}